package cn.com.git.workflow.server.ctrler;

import cn.com.git.common.base.BaseController;
import cn.com.git.common.model.ResultPage;
import cn.com.git.workflow.server.api.feign.workflow.WorkflowFeignService;
import cn.com.git.workflow.service.dto.WorkFlowConfigListDTO;
import cn.com.git.workflow.service.dto.WorkFlowListDTO;
import cn.com.git.workflow.service.query.WorkFlowConfigListQuery;
import cn.com.git.workflow.service.query.WorkFlowListQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2020/3/1 0001 12:26
 */
@Controller
@RequestMapping("/work_flow_set")
public class WorkFlowSetCtrler extends BaseController {

    @Autowired
    private WorkflowFeignService workflowFeignService;

    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public ModelAndView index(){
        ModelAndView mv = new ModelAndView("work_flow_set/index");
        return mv ;
    }

    @RequestMapping(value = "/list/page", method = RequestMethod.POST)
    @ResponseBody
    public ResultPage<WorkFlowConfigListDTO> listPage(WorkFlowConfigListQuery query) {
        ResultPage<WorkFlowConfigListDTO> resultPage = workflowFeignService.workFlowConfigListPage(query);
        return resultPage;
    }

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public ModelAndView add() {
        ModelAndView mv = new ModelAndView("work_flow_set/add");
        return mv ;
    }
//
//    @RequestMapping(value = "/add", method = RequestMethod.POST)
//    @ResponseBody
//    public ResultMsg<SysResourceSaveDTO> add(@RequestBody SysResourceSaveDTO form) {
//        ResultMsg<SysResourceSaveDTO> resultMsg = systemFeignService.sysResourceAdd(form);
//        webSocketService.sendMessage("资源新增");
//        return resultMsg;
//    }
//
//    @RequestMapping(value = "/edit", method = RequestMethod.POST)
//    @ResponseBody
//    public ResultMsg<SysResourceSaveDTO> edit(@RequestBody SysResourceSaveDTO form) {
//        ResultMsg<SysResourceSaveDTO> resultMsg = systemFeignService.sysResourceEdit(form);
//        webSocketService.sendMessage("资源编辑页面");
//        return resultMsg;
//    }
//
//    @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
//    public ModelAndView edit(@PathVariable("id") Integer id) {
//        ModelAndView mv = new ModelAndView("sys_resource/edit");
//        ResultMsg<SysResourceDetailDTO> resultMsg = systemFeignService.sysResourceFind(id);
//        resultMsg.getData().getParent().getIcon();
//        mv.addObject("dto",resultMsg.getData());
//        webSocketService.sendMessage("资源编辑");
//        return mv ;
//    }
//
//    @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
//    @ResponseBody
//    public ResultMsg delete(@PathVariable("id") Integer id) {
//        ResultMsg resultMsg = systemFeignService.sysResourceDelete(id);
//        return resultMsg;
//    }
}
